Skip to content

Improve Log Attributes API #4416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 22, 2025

Conversation

adinauer
Copy link
Member

@adinauer adinauer commented May 19, 2025

📜 Description

Improve Log Attributes API:

  • Add Sentry.logger().log() overload that takes a LogParams param object
    • This avoids having tons of overloads and creating a large pyramid of methods
    • Having multiple overloads is especially problematic with varargs since it can easily become ambiguous
  • Add SentryAttributes and SentryAttribute
  • SentryAttributeType enum

💡 Motivation and Context

💚 How did you test it?

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Copy link
Contributor

github-actions bot commented May 19, 2025

Fails
🚫 Please consider adding a changelog entry for the next release.
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- Improve Log Attributes API ([#4416](https://github.com/getsentry/sentry-java/pull/4416))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against fae5ee1

Copy link
Contributor

github-actions bot commented May 19, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 413.50 ms 440.90 ms 27.40 ms
Size 1.58 MiB 2.08 MiB 510.54 KiB

Baseline results on branch: feat/logs-attributes-in-api

Startup times

Revision Plain With Sentry Diff
93da41e 429.70 ms 484.57 ms 54.87 ms
878e381 402.20 ms 417.65 ms 15.45 ms
4c45928 454.84 ms 508.46 ms 53.62 ms

App size

Revision Plain With Sentry Diff
93da41e 1.58 MiB 2.08 MiB 510.52 KiB
878e381 1.58 MiB 2.08 MiB 510.51 KiB
4c45928 1.58 MiB 2.08 MiB 510.86 KiB

Previous results on branch: feat/better-attributes-api

Startup times

Revision Plain With Sentry Diff
fe70d60 401.20 ms 545.47 ms 144.27 ms

App size

Revision Plain With Sentry Diff
fe70d60 1.58 MiB 2.08 MiB 510.53 KiB

Copy link
Member

@lcian lcian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, LGTM!

@adinauer
Copy link
Member Author

Merging this into #4402 to finish up there.

@adinauer adinauer merged commit 2aa5b77 into feat/logs-attributes-in-api May 22, 2025
30 of 33 checks passed
@adinauer adinauer deleted the feat/better-attributes-api branch May 22, 2025 10:08
adinauer added a commit that referenced this pull request May 22, 2025
* Extend Logs API to allow passing in attributes

* update (#4409)

* Improve Log Attributes API (#4416)

* Improve logger attributes API

* Review feedback

* changelog

---------

Co-authored-by: Lorenzo Cian <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants